<template>
  <div>
    <button @click="handleIncrement">加</button>
    <button @click="handleDecrement">减</button>
  </div>
</template>

<!-- 回调事件父子组件传值 -->
<script setup lang="ts">
const emit = defineEmits(['increment', 'decrement']);

const handleIncrement = () => {
  emit('increment');
};

const handleDecrement = () => {
  emit('decrement');
};
</script>